package com.xinqi.util;

import com.xinqi.util.pipeline.SinglePipeline;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.reflect.Field;

/**
 * @author xin麒
 * @date 2023/8/25 19:39
 */
public class GCUtil {
    private static Logger logger = LoggerFactory.getLogger(GCUtil.class);
    public static void helpGC(Object obj){
        Field[] fields = obj.getClass().getDeclaredFields();
        try {
            for (Field field : fields) {
                //设置允许通过反射访问私有变量
                field.setAccessible(true);
//                logger.info("field.Name is "+field.getName());
                //获取字段的值
                field.set(obj,null);
                //其他自定义操作

            }
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
//        logger.info("fields.length is " + fields.length);
    }
}
